package com.east.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.east.dao.UserMapper;
import com.east.model.User;
import com.east.service.UserService;

/**
 * @author gacl
  * 使用@Service注解将UserServiceImpl类标注为一个service
 * service的id是userService
  */
 @Service("userService")
public class UserServiceImpl implements UserService {

	    /**
	     * 使用@Autowired注解标注userMapper变量，
	     * 当需要使用UserMapper时，Spring就会自动注入UserMapper
	     */
	    @Autowired
	    private UserMapper userMapper;//注入dao
	
	    @Override
	    public void addUser(User user) {
	        userMapper.insert(user);
	    }
	
	    @Override
	    public User getUserById(String userId) {
	        return userMapper.selectByPrimaryKey(Integer.valueOf(userId));
	    }

		@Override
		public int deleteByPrimaryKey(Integer userId) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public int insert(User record) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public int insertSelective(User record) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public User selectByPrimaryKey(Integer userId) {
			// TODO Auto-generated method stub
			return null;
		}

		@Override
		public int updateByPrimaryKeySelective(User record) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public int updateByPrimaryKey(User record) {
			// TODO Auto-generated method stub
			return 0;
		}

		@Override
		public List<User> listUsers() {
			List<User> users=userMapper.listUsers();
			return users;
		}

}
